<?php 


$title = '产品中心';

$css = 'product';

$tpid =4;

/********************************************************二级菜单************************************************/


	//header 当前状态效果
	$hid =isset($_GET['hid'])?$_GET['hid']:$tpid;
	//当前页类信息
	
	$curcate = dbselOne($con,'category','*',$tpid);

	//二级类信息
	$secondary = dbselect($con,'category','*',"pid=$tpid");
	
	
	//二级菜单当前状态效果
	$sid = isset($_GET['sid'])?$_GET['sid']:$secondary[0]['id'];

	//当前二级类信息

	$cursec = dbselOne($con,'category','*',$sid);	


	
/***************************产品分页**************************/
	//产品单类条数
	$rows = count(dbselect($con,'products','*',"category_id=$sid"));

	//每页条数
	$num = 9;
	//当前页
	$p = isset($_GET['p'])?$_GET['p']:1;
	//除去的条数
	$c = ($p-1)*$num;
	//产品信息查找
	$product = dbselect($con,'products','id,name,launch_time,intro,img_path',"category_id=$sid","launch_time desc","{$c},{$num}");

	$tag = "<li>";
	$etag = "</li>";
	$purl = "&m=".M.'&c='.C.'&v='.V.'&sid='.$sid.'&hid='.$hid;
	$page = page($con,'news',$p,$rows,$num,$purl,$tag,$etag);

	foreach($product as $k => $val){
		$product[$k]['Ym_time'] = date('Ym',$val['launch_time']);

		$product[$k]['img_path'] = json_decode($val['img_path']);

		
	}


	//banner图查询
	$banner = dbselect($con,'banner','*',"cate_id='{$hid}' and status = 1",'create_time desc','1');


	if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){



		$list['product'] = $product;

		$list['page'] = $page;

		$list['img'] = IMG;

		$list['sid'] = $sid;

		$list['hid'] = $hid;


		echo json_encode($list);die;
	}


//连接视图

require("application/home/views/public/header.html");

include("application/".M."/views/".C."/".V.".html");

require("application/home/views/public/footer.html");


?>